<?php
include 'DatabaseConnect.inc';
session_start();

if($_SERVER['REQUEST_METHOD'] == "POST") {
	 $query = "SELECT * FROM User WHERE LoginID = '".$_POST['username']."' AND Password = '".$_POST['password']."'";
     $result = mysql_query($query);
     if(mysql_num_rows($result) == 1) {
		 $row = mysql_fetch_array($result);
         $_SESSION['is_logged_in'] = 1;
		 $_SESSION['UName'] = $_POST['username'];
		 $_SESSION['AType'] = $row['Type'];
     }
}

if(!isset($_SESSION['is_logged_in'])) {

?>



<HTML>
<head>
<title>ZionsAuto</title>
  <style type="text/css">
  #footer {
   position:absolute;
   bottom:0;
   width:99%;
   height:70px;   /* Height of the footer */
  }
  
  #login {
	float:right;
	margin:40px;
  }
  

  </style>
</head>
<BODY>
<h1><center>Welcome to Zion's Auto!</center></h1>
<hr>


<!-- <div  style="float:right; margin:40px;"> -->
<!-- Login and Register Section -->
<div id="login">
<form action="index.php" method="post">
Username: <input type="text" name="username"/><br />
Password: <input type="password" name="password"/><br />
<input type="submit" value="Login"/>
</form>
<br />
<p>Register Today!</p>
<form action="CreateAccount.php" method="post">
<input type="submit" value="Create Account"/>
</form>
</div>


<img src="RRphantom.jpg" height="200" width="200">
<img src="lambo.jpg" height="200" width="200"><br/>
<img src="bugatti.jpg" height="200" width="200">
<img src="ferrari.jpg" height="200" width="200">

<!-- Footer Goes Here -->
<div id="footer">
<hr>
<P>(C)Copyright 2011 Zion's DBA. All Rights Reserved</P>
</div>

</BODY>
</HTML>

<?php
  }
  else
  {
		header('location:homePage.php');
	
	}
    mysql_close();
?>